package com.mvp.lt.airlineview.gesture;

import android.view.MotionEvent;

import com.mvp.lt.airlineview.utils.LogUtil;
import com.mvp.lt.airlineview.view.TouchView;

/**
 * Created by LiuTao on 2019/11/14 0014 上午 9:51
 * functiona:
 */
public class MyGestureDetector extends TouchGestureDetector.OnTouchGestureListener {
     String TAG = "MyGestureDetector";
    TouchView mTouchView;
    ISelectionListener mISelectionListener;

    public MyGestureDetector(TouchView touchView,ISelectionListener listener) {
        super();
        this.mTouchView = touchView;
        this.mISelectionListener = listener;
    }

    @Override
    public boolean onDown(MotionEvent e) {
        LogUtil.e(TAG,"----------按下 onDown------------");

       return true;
    }


    @Override
    public void onScrollBegin(MotionEvent e) {
        LogUtil.e(TAG,"-----------开始滚动 onScrollBegin-----------");
    }

    @Override
    public void onScrollEnd(MotionEvent e) {
        LogUtil.e(TAG,"-----------结束滚动 onScrollEnd-----------");
    }

    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        LogUtil.e(TAG,"------------滚动中 onScroll----------");
        return true;
    }

    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        LogUtil.e(TAG,"-------------点击抬起 onSingleTapUp---------");
        return true;
    }

    @Override
    public boolean onScale(ScaleGestureDetectorApi27 detector) {
        LogUtil.e(TAG,"-----------缩放中 onScale-----------");
        return true;
    }

    @Override
    public boolean onScaleBegin(ScaleGestureDetectorApi27 detector) {
        LogUtil.e(TAG,"----------开始缩放 onScaleBegin------------");
        return true;
    }

    @Override
    public void onScaleEnd(ScaleGestureDetectorApi27 detector) {
        LogUtil.e(TAG,"------------缩放结束 onScaleEnd----------");
    }

    public interface ISelectionListener {
        /**
         * called when the item(such as text, texture) is selected/unselected.
         * item（如文字，贴图）被选中或取消选中时回调
         *
         * @param selected 是否选中，false表示从选中变成不选中
         */
        void onSelectedItem(IDoodle doodle, ITouchSelectableItem selectableItem, boolean selected);

        /**
         * called when you click the view to create a item(such as text, texture).
         * 点击View中的某个点创建可选择的item（如文字，贴图）时回调
         *
         * @param x
         * @param y
         */
        void onCreateSelectableItem(IDoodle doodle, float x, float y);
    }

}
